package com.controller;


import com.pojo.Car;
import com.service.CarService;
import com.util.ResponeCar;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * @Author xu
 * @Description
 * @Date 2022.2.24
 */
@RestController
@RequestMapping("/getCar")
public class CarController {
    @Autowired
    private CarService carService;

    @RequestMapping("/getnumber")
    public ResponeCar getCarList(Integer getid){
        List<Car> list = carService.getCar(getid);
        //System.out.println(list);
        if(list!=null){
            return  new ResponeCar(1, (ResponeCar) list);
        }
        return new ResponeCar(0,new ResponeCar());
    }
    @RequestMapping("/getprice")
    public ResponeCar getCarprice(Integer getid){
        List<Car> list = carService.findCar(getid);
        if (list!=null){
            return  new ResponeCar(1, (ResponeCar) list);
        }
        return new ResponeCar(0,new ResponeCar());
    }

}
